﻿using SpaceNeedle.x6473.WindowsPhone.Models;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace SpaceNeedle.x6473.WindowsPhone.Converters
{
    public class RequestItemStatusToStringConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if(value == null)
            {
                return string.Empty;
            }

            int status = System.Convert.ToInt32(value);

            bool isResumed = parameter != null ? System.Convert.ToBoolean(parameter) : false;

            if (!isResumed)
            {
                switch (status)
                {
                    case 0:
                        return "Aberto";
                    case 1:
                        return "Em Andamento";
                    case 2:
                        return "Fechado Com Solução";
                    case 3:
                        return "Fechado Sem Solução";
                }
            }else
            {
                switch (status)
                {
                    case 0:
                        return "aberto";
                    case 1:
                        return "resolvendo";
                    case 2:
                        return "atendido";
                    case 3:
                        return "fechado";
                }
            }

            return string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return string.Empty;
        }
    }
}
